package pl.com.qapps.datastore.berkeley.impl;

import java.io.IOException;

import com.sleepycat.bind.serial.StoredClassCatalog;
import com.sleepycat.je.Database;
import com.sleepycat.je.DatabaseConfig;
import com.sleepycat.je.Environment;

public class ClassesStore extends StoreTable {

	private final StoredClassCatalog classes;
	
	public ClassesStore(Environment env, String filename) {
		super(env);
		
		DatabaseConfig cfg = new DatabaseConfig();
		cfg.setTransactional(true);
		cfg.setAllowCreate(true);
		
		Database db = env.openDatabase(null, filename, cfg);
		classes = new StoredClassCatalog(db);
	}
	
	@Override
	public void close() throws IOException {
		classes.close();
	}

}
